<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>User page</title>
</head>
<body>
	<s:head />
	<s:form action="saveOrUpdateUser" method="POST">

		<s:hidden name="user.id" value="%{user.id}" />
		<s:textfield label="User Name" name="user.name" value="%{user.name}" />
		<s:radio label="Gender" list="{'Male','Female','Not sure'}"
			name="user.gender" value="%{user.gender}" />
		<s:select name="user.country" headerKey="" headerValue="Select"
			label="Select a country" list="{'India','Vietnam','USA','Japan'}"
			value="%{user.country}" />
		<s:textarea cols="30" name="user.aboutYou" label="About You"
			value="%{user.aboutYou}" />
		<s:checkbox name="user.mailingList"
			label="Would you like to join our mailing list?"
			value="%{user.mailingList}" />
		<s:submit value="Save" align="right" />

	</s:form>
	<s:if test="listUser.size() > 0">
		<div>
			<table cellpadding="5px" border="3px" bordercolor="red">
				<tr>
					<th>Name</th>
					<th>Gender</th>
					<th>Country</th>
					<th>About You</th>
					<th>Mailing List</th>
					<th>Edit</th>
					<th>Delete</th>
				</tr>
				<s:iterator value="listUser">
					<tr>
						<td><s:property value="name" /></td>
						<td><s:property value="gender" /></td>
						<td><s:property value="country" /></td>
						<td><s:property value="aboutYou" /></td>
						<td><s:property value="mailingList" /></td>
						<td><s:url id="editURL" action="editUser">
								<s:param name="id" value="%{id}" />
							</s:url> <s:a href="%{editURL}">Edit</s:a></td>
						<td><s:url action="deleteUser" id="deleteURL">
								<s:param name="id" value="%{id}" />
							</s:url> <s:a href="%{deleteURL}">Delete</s:a></td>
					</tr>
				</s:iterator>
			</table>
		</div>
		<p><a href='<s:url action="deleteAll"/>'>Delete All Users</a>.</p>
	</s:if>
</body>
</html>